/*  File Name	: GatePlayer.cpp
 *  Author		: Pang Jiacai
 *	 E-mail		: 823960168@qq.com
 *  Created on	: 2012-10-15
 *  Description:
 */

#include "GatePlayer.h"
#include "GateMonitor.h"

GatePlayer::GatePlayer(int p)
{
	this->reset();
}

GatePlayer::~GatePlayer()
{

}

void GatePlayer::reset(void)
{
	this->db_info_.reset();
	this->role_id_ =0;
	this->svc_id_ =0;
	this->cur_room_=0;
	this->login_ = false;
	this->account_ = "";
	//this->cancel_timer();
}

void GatePlayer::svc_id(int id)
{
	this->svc_id_ = id;
}
void GatePlayer::cur_room(int id)
{
	this->cur_room_ = id;
}

//void GatePlayer::switch_room(int id)
//{
//	this->switch_room_ = id;
//}

DBInfo &GatePlayer::dbinfo(void)
{
	return this->db_info_;
}

void  GatePlayer::monitor(GateMonitor *monitor)
{
//	this->monitor_ = monitor;
//	if(NULL!=this->monitor_)
//	{
//		this->reactor(this->monitor_->reactor());
//	}
}

int GatePlayer::svc_id(void)
{
	return this->svc_id_;
}

int GatePlayer::cur_room(void)
{
	return this->cur_room_;
}

//int GatePlayer::switch_room(void)
//{
//	return this->switch_room_;
//}

int GatePlayer::handle_timeout(void)
{
	return this->logout(false);
}

void GatePlayer::login(bool login)
{
	this->login_ = login;
}

bool GatePlayer::is_login(void)
{
	return this->login_;
}

int GatePlayer::logout(bool exception)
{
//	if(exception)
//	{
//		return this->schedule_timer(TimeValue::zero,TimeValue(60));
//	}

	return 0;
}
